#pragma once

#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>

#include "exports.hpp"
#include "Attribute.hpp"




namespace db
{
	class DB_SCHEMA_API Table
		: public boost::enable_shared_from_this<Table>
	{
	public:

		typedef boost::shared_ptr<Table>         Ptr;
		typedef boost::shared_ptr<const Table>   const_Ptr;

	public:

		Table();
		virtual ~Table();



		/**
		 * @returns the symbolic name of this table in the application
		 */
		virtual QString name() const = 0;

		/**
		 * @returns the name of the table in the database
		 */
		virtual QString dbName() const = 0;

		/**
		 * @returns the number of attributes in the database
		 */
		virtual std::size_t numAttributes() const = 0;

		/**
		 * @returns the i-th attribute of this table
		 */
		virtual Attribute::const_Ptr attribute(std::size_t i) const = 0;

		/**
		 * @returns the attribute with the given name
		 */
		virtual Attribute::const_Ptr attribute(QString name) const = 0;
	};
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
